<template>
  <div class="mui-numbox" data-numbox-min="1" style="height:25px">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input
      class="mui-input-numbox"
      type="number"
      @change="postnum"
      ref="numbox"
      :value="initcount"
      readonly
    />
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>
<style lang="less" scoped>
</style>
<script>
import mui from "../../lib/mui/js/mui.min.js";
export default {
  props: ["initcount", "goodsId"],
  mounted() {
    mui(".mui-numbox").numbox();
  },
  methods: {
    postnum() {
      this.$store.commit("updataCount", {
        id: this.goodsId,
        count: this.$refs.numbox.value
      });
    }
  }
};
</script>